package com.shy.lifecallback;

import jakarta.annotation.PostConstruct;
import jakarta.annotation.PreDestroy;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;

public class ShyService implements InitializingBean, DisposableBean {
    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("基于接口：初始化 afterPropertiesSet");
    }

    @PostConstruct
    public void init() {
        System.out.println("基于注解: 初始化 init");
    }

    public void initMethod() {
        System.out.println("initMethod: 初始化 initMethod");
    }

    public void test() {
        System.out.println("测试 test");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("基于接口：销毁 destroy");
    }

    public void destroyMethod() {
        System.out.println("destroyMethod：销毁 destroy");
    }

    @PreDestroy
    public void preDestroy() {
        System.out.println("基于注解: 销毁 destroy preDestroy");
    }

}
